﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TeamExplorer.Merge.Helper
{
    public static class DateTimeExtensions
    {
        internal static DateTime GetYesterday(this DateTime dt)
        {
            return dt.AddDays(-1.0);
        }

        internal static DateTime GetStartOfWeek(this DateTime dt)
        {
            DayOfWeek firstDayOfWeek = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
            int length = CultureInfo.CurrentCulture.DateTimeFormat.DayNames.Length;
            int num = dt.DayOfWeek - firstDayOfWeek;
            if (num < 0)
                num += length;
            return dt.AddDays((double)-num);
        }
    }
}
